class Project < ActiveRecord::Base
  acts_as_authorization_object
  belongs_to :final_clients, :foreign_key => "final_client_id"
  belongs_to :clients, :foreign_key => "client_id"
  belongs_to :responsibles, :foreign_key => "responsible_id"
  
  has_many :project_tasks
  has_many :tasks, :through => :project_tasks
  
  validates_presence_of :project_reference
  validates_presence_of :project_number
  validates_presence_of :client_id
  validates_presence_of :responsible_id
  
  validates_numericality_of :state, :only_integer => true
  
  validates_uniqueness_of :project_reference
end
